package main

import (
	"net/http"
	"fmt"
	"os"
	"time"
	"strconv"
	"gitee.com/DengAnbang/goutils/loge"

	"gitee.com/DengAnbang/goutils/update"
)

func main() {

	mux := http.NewServeMux()
	mux.HandleFunc("/", handler)
	mux.HandleFunc("/test", test)
	update.UpgradeService(":8081", mux)
}
func handler(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()
	s := r.Form.Get("time")
	i, _ := strconv.Atoi(s)
	time.Sleep(time.Second * time.Duration(i))
	loge.E()
	fmt.Fprintf(w, "测试=%d", os.Getpid())
}
func test(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()
	time.Sleep(time.Second * time.Duration(15))
	fmt.Fprintf(w, "时间 =%d", os.Getpid())
}
